package com.lm.scau.dyb.inter;

import android.support.v4.app.FragmentActivity;

import com.lm.scau.dyb.activity.base.BaseActivity;

/**
 * Function:
 * auth：liming on 2016/8/5 15:35
 * mail：liming@wxchina.com
 */
public class UICore {

    public static CommandTaskEvent eventTask(BasicUIEvent basicUIEvent, FragmentActivity context, PreExecuteEvent preEvent, PostExecuteEvent posEvent, int CommandID, String tips, Object obj) {
        CommandTaskEvent commandTask = null;
        try {
            commandTask = new CommandTaskEvent(basicUIEvent, preEvent, posEvent);
            commandTask.execute((new Object[]{CommandID + "", obj}));
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("cancel:  success!!");

        }
        return commandTask;
    }

    public static CommandTaskEvent eventTask(BasicUIEvent basicUIEvent, BaseActivity context, PreExecuteEvent preEvent, PostExecuteEvent posEvent, int CommandID, String tips, Object obj) {
        CommandTaskEvent commandTask = null;
        try {
            commandTask = new CommandTaskEvent(basicUIEvent, preEvent, posEvent);
            commandTask.execute((new Object[]{CommandID + "", obj}));
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("cancel:  success!!");
        }
        return commandTask;
    }

    public static CommandTaskEvent eventTask(BasicUIEvent basicUIEvent, BaseActivity context, int CommandID, String tips, Object obj, boolean showLoading) {
        CommandTaskEvent commandTask = null;
        try {
            commandTask = new CommandTaskEvent(basicUIEvent, context, tips, showLoading);
            commandTask.execute((new Object[]{CommandID + "", obj}));
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("cancel:  success!!");
            if (context != null) ;
            //    context.destroyDialog();
        }
        return commandTask;
    }
}
